//引入Vue和VueRouter
import Vue from 'vue'
import VueRouter from 'vue-router'

// 引入element-ui
import ElementUI from 'element-ui';
// 引入element-ui样式
import 'element-ui/lib/theme-chalk/index.css';
// 引入自定义页面
// 登录界面
import LoginView from '@/views/Login.vue'
// 首页
import ConsoleIndex from '../views/Home/index.vue'
// 子页面
import BrandView from '@/views/Home/SubInterface/Brand.vue';
import Carousel_figureView from '@/views/Home/SubInterface/Carousel_figureView.vue';
import OrderView from '@/views/Home/SubInterface/OrderView.vue';
import ProductTypeView from '@/views/Home/SubInterface/ProductTypeView.vue';
import OrderProduct from '@/views/Home/SubInterface/OrderProduct.vue';
import ProductView from '@/views/Home/SubInterface/ProductView.vue';
import Receiving_addressView from '@/views/Home/SubInterface/Receiving_addressView.vue';
import SalesView from '@/views/Home/SubInterface/SalesView.vue';
import SearchHistory from '@/views/Home/SubInterface/SearchHistory.vue';
import ShopCartProductView from '@/views/Home/SubInterface/ShopCartProductView.vue';
import ShopCartView from '@/views/Home/SubInterface/ShopCartView.vue';
import UserView from '@/views/Home/SubInterface/UserView.vue';



//使用组件

Vue.use(VueRouter)
Vue.use(ElementUI);

//路由规则
const routes = [
  //控制台 嵌套页面
  {
    //父载页面
    path: '/console',
    name: 'console',
    component: ConsoleIndex,
    //子页面
    children: [
      {
        path: '/brand',
        name: 'brand',
        component: BrandView
      },
      {
        path: '/carousel_figure',
        name: 'carousel_figure',
        component: Carousel_figureView
      },
      {
        path: '/order',
        name: 'order',
        component: OrderView
      },
      {
        path: '/producttype',
        name: 'producttype',
        component: ProductTypeView
      },
      {
        path: '/sales',
        name: 'sales',
        component: SalesView
      },
      {
        path: '/search-history',
        name: 'search-history',
        component: SearchHistory
      },
      {
        path: '/shopcartproduct',
        name: 'shopcartproduct',
        component: ShopCartProductView
      },
      {
        path: '/product',
        name: 'product',
        component: ProductView
      },
      {
        path: '/shopcart',
        name: 'shopcart',
        component: ShopCartView
      },
      {
        path: '/orderproduct',
        name: 'orderproduct',
        component: OrderProduct
      },
      {
        path: '/user',
        name: 'user',
        component: UserView
      },
      {
        path: '/receiving_address',
        name: 'receiving_address',
        component: Receiving_addressView
      }
    ]
  },
  // 登录页面 /根目录
  {
    path: '/',
    name: 'login',
    component: LoginView
  }
]

const router = new VueRouter({
  routes
})

export default router